<?php

class ContentRecord extends TActiveRecord
{
	const TABLE = 'contents';
	
	// fields
	public $name;
	public $text;

	public function setName($name)      { $this->name = $name; }
	public function setText($text)      { $this->text = $text; }
	
	public function getName()           { return $this->name; }
	public function getText()           { return $this->text; }
	
	public function setData($name, $text)
	{
		$this->setName( $name );
		$this->setText( $text );
	}
	
	public function setDataByContentRecord($contentRecord)
	{
		if($contentRecord instanceof ContentRecord)
		{
			$this->setData($contentRecord->getName(), $contentRecord->getText());
		}
	}
	
	public function equals($contentRecord)
	{
		if($contentRecord instanceof ContentRecord)
		{
			return 	$this->getName() == $contentRecord->getName()	 &&
					$this->getText() == $contentRecord->getText();
		}
		return false;
	}
	
	public static function finder($className=__CLASS__)
	{
		return parent::finder($className);
	}
}

?>